/*
 * ConvenienceHibernateDaoSupport.java
 *
 * Project: TECHWATCH - TESTING TECHNOLOGIES
 *
 * Copyright 2008 by ELCA Informatique SA
 * Av. de la Harpe 22-24, 1000 Lausanne 13
 * All rights reserved.
 *
 * This software is the confidential and proprietary information
 * of ELCA Informatique SA. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license
 * agreement you entered into with ELCA.
 */

package ch.elca.training.dao.core.hibernate;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * 
 * Convenience Hibernate dao support class to be able to return the convenience Hibernate template
 * without casting it.
 * 
 * @author Alex Mathey (AMA)
 */
public class ConvenienceHibernateDaoSupport extends HibernateDaoSupport {

    /**
     * @return Returns the Hibernate template casted to the convenience model of it.
     */
    public ConvenienceHibernateTemplate getConvenienceHibernateTemplate() {
        return (ConvenienceHibernateTemplate) this.getHibernateTemplate();
    }

    /**
     * @param template
     *            Is the convenience Hibernate template to set.
     */
    public void setConvenienceHibernateTemplate(final ConvenienceHibernateTemplate template) {
        this.setHibernateTemplate(template);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected HibernateTemplate createHibernateTemplate(final SessionFactory sessionFactory) {
        return new ConvenienceHibernateTemplate(sessionFactory);
    }
}
